package com.hly.musicbackground.Utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class DateUtils {
    public static String dateToString(Date date, String str){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(str);
        return simpleDateFormat.format(date);
    }

    public static Date currentTimeSubtract(long y){
        return new Date(System.currentTimeMillis() - y);
    }

    public static String dateToString(String str){
        return dateToString(new Date(), str);
    }

    public static Date ZeroTime(int year, int month, int day) {
        Calendar cal = Calendar.getInstance();
        cal.set(cal.get(Calendar.YEAR) - year, cal.get(Calendar.MONTH) - month,
                cal.get(Calendar.DAY_OF_MONTH) - day, 0, 0, 0);
        return cal.getTime();
    }
}
